{extend name='common/_container'}
{block name="content"}
<div class="ibox float-e-margins">
<input type="hidden" name='id' id='id' value="{$info.id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row">
				<div class="col-sm-12">
				<!-- form start -->
					<div class="form-group introducer">
						<label class="col-sm-2 control-label">介绍人：</label>
						<div class="col-sm-9">
							<input type="text" id="name" value="{$info.name}" name="name" class="form-control" placeholder="请输入介绍人">
						</div>
					</div>
					<div class="form-group introducer_mobile">
						<label class="col-sm-2 control-label">介绍人电话：</label>
						<div class="col-sm-9">
							<input type="text" id="mobile" value="{$info.mobile}" name="mobile" class="form-control" placeholder="请输入介绍人电话">
						</div>
					</div>
					<div class="form-group layui-form" id="jsrbankimgdiv" >
					<label class="col-sm-2 control-label">银行卡图片：</label>
					<div class="col-sm-6">
						<input type="text" id="jsrbankimg" value="{$info.jsrbankimg}" name="jsrbankimg"  class="form-control" placeholder="">
						<div style="clear:both"></div>
						<div class="jsrbankimg pic_list"></div>
						<span class="help-block m-b-none jsrbankimg_process"></span>
					</div>
					<div class="col-sm-1" style="padding-left:0; padding-right:0">
						<span id="jsrbankimg_upload"></span>
					</div>
				</div>
				<!-- form end -->
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-9 col-sm-offset-1">
					<button type="button" class="btn btn-primary" onclick="{if condition="$info.id neq ''"}CodeInfoDlg.update(){else/}CodeInfoDlg.add(){/if}" id="ensure">
						<i class="fa fa-check"></i>&nbsp;确认提交
					</button>
					<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
						<i class="fa fa-eraser"></i>&nbsp;取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="__PUBLIC__/static/js/admin/Introducer.js?t=<?php echo rand(1000,9999)?>" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/plugins/layui/layui.js?t=1498856285724" charset="utf-8"></script>
<script>
layui.config({dir: '__PUBLIC__/static/js/plugins/layui/'});
	layui.use(['layer', 'form'], function () {
	window.layer = layui.layer;
	window.form = layui.form();
});
layui.use('element', function(){
	var element = layui.element();
	element.on('tab(test)', function(elem){
	});
});

var images4 = $("#jsrbankimg").val();
default_value4 = getDefaultVal(images4);
uploader('jsrbankimg_upload','jsrbankimg','image',true,default_value4,'{:url("admin/Upload/uploadImages")}');
function getDefaultVal(images) {
	var default_value;
	var images = images.substr(0,images.length-1);

	if(images !== ''){
		var images_value;
		if(images.indexOf("|") == -1){
			images_value = '["'+images+'"]';
		}else{
			images_value = JSON.stringify(images.split("|"));
		}
		default_value = images_value;
	}else{
		default_value = '';
	}
	return default_value;
}

$("#name").blur(function(){
	var name =$.trim($(this).val());
	var html='<small class="help-block" id="is_exist" style="display: none;">该介绍人已经存在</small>';
	$(this).parent().append(html);
	if(name!=''){
		$.post("{:url('admin/Record.Introducer/checkName')}",{name:name},function(result){
			if(result.status!='00'){
				$("#is_exist").show();
				$("#name").next().removeClass('glyphicon-ok').addClass('glyphicon-remove');
				$("#name").parent().parent().removeClass('has-success').addClass('has-error');
			}
		});
	}
});

$("#name").keyup(function(){
	var flag=false;
	$(this).nextAll('small').not('#is_exist').each(function(){
		if($(this).is(':visible')){
			flag=true;
		}
	})
	if(flag){
		$("#is_exist").hide();
	}
});
</script>


{/block}
